<?php
/**
 * User:于小涛
 * Date:2020/2/18
 * Time:16:31
 */
namespace app\admin\business\rbac;
use app\admin\model\rbac\AdminRole;

class Admin{

    private $obj_admin_role_model=null;
    public function __construct()
    {
        $this->obj_admin_role_model = new AdminRole();
    }
    /**
     * 给管理员配置角色
     * User:于小涛
     * Date:2020/2/18
     * Time:16:07
     * @param $int_admin_id
     * @param $arr_role_ids
     * @return int
     * @throws \Exception
     */
    public function configRole($int_admin_id,$arr_role_ids){
        $this->obj_admin_role_model->delByAdminId($int_admin_id);
        $arr_add_data=array();
        foreach($arr_role_ids as $int_role_id){
            $arr_add_data[]=array(
                'role_id'=>$int_role_id,
                'admin_id'=>$int_admin_id
            );
        }
        return $this->obj_admin_role_model->add($arr_add_data);
    }
}